package com.burns.flash.javafx.stage;/**
 * Created by burns.
 *
 * @author <a href="http://www.esoon-soft.com/">burns</a>
 * @date 2022/02/21 13:38
 */

import javafx.application.Application;
import javafx.stage.Stage;

/**
 * @param null
 * @author burnsZhang
 * @description The JavaFX Stage can emit a few events you can listen for. These Stage events are:
 * <p>
 * Close Request
 * Hiding
 * Hidden
 * Showing
 * Shown
 * @date 2022/2/21
 * @return:
 */
public class StageLifeCycleEvents extends Application {

    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) {
        primaryStage.setOnCloseRequest((event) -> {
            System.out.println("Closing Stage");
        });

        primaryStage.setOnHiding((event) -> {
            System.out.println("Hiding Stage");
        });

        primaryStage.setOnHidden((event) -> {
            System.out.println("Stage hidden");
        });

        primaryStage.setOnShowing((event) -> {
            System.out.println("Showing Stage");
        });

        primaryStage.setOnShown((event) -> {
            System.out.println("Stage Shown");
        });

        primaryStage.show();
    }
}
